import { getRecommedApi } from '../../api/home'
const homeStore = {
  namespaced: true,
  state: {
    recommedList: []
  },
  mutations: {
    changeData (state, res) { //赋值推荐数据
      state.recommedList = state.recommedList.concat(res.data);
    },
    clearList (state) { //下拉  用来清空以前的数据
      state.recommedList = [];
    }
  },
  actions: {
    async getRecommedAction ({ commit }, p) {
      var res = await getRecommedApi({ p: p })
      console.log(res)
      commit("changeData", res)
      return Promise.resolve(true)
    }
  },
  getters: {
    recommedList: state => state.recommedList
  }
}
export default homeStore